# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pyip
pkgname=('python2-pyip' 'python-pyip')
_pkgname=pyip
pkgver=0.7
pkgrel=6
pkgdesc='Assemble/disassemble raw ip packet.'
arch=('any')
url='https://pypi.org/project/pyip/#files'
license=('PSF')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('190319a508af8069194cca7d954a87cd4777f2d4cabf199a0c52abe7a54dea65f541b24f42d10d52b325d40b0ad29f903ff5b28118a05a5e57c4f16d78a48f01')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pyip() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

package_python-pyip() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

